/**
 * @param {String} key
 * @return {Object} value
 */
function get(key) {
	let value;
	try {
		value = uni.getStorageSync(key)
	} catch (e) {
		console.error(e)
	}
	return value;
}

function set(key, value) {
	let result = true;
	try {
		uni.setStorageSync(key, value);
	} catch (e) {
		result = false;
	}
	return result;
}
const unLoginUser = {
	nickname: "未登录",
	avatar_file: {
		url: "https://img1.baidu.com/it/u=2250275304,3941496093&fm=253&fmt=auto&app=138&f=GIF?w=200&h=200"
	}
};
//Tokenout true时没有超期 false时超时
const TokenOut = (new Date).getTime() < get(' uni_id_token_expired ') //获取以后判断一下没有内容的话返回一个未登录的用户信信对象
const userinfo = TokenOut ? get('uni-id-pages-userInfo') : unLoginUser
export default {
	get,
	set,
	userinfo,
	TokenOut
}
